from typing import Optional
from pydantic import BaseModel, Field

class Token(BaseModel):
    """令牌响应模型"""
    access_token: str
    token_type: str = "bearer"

class TokenPayload(BaseModel):
    """令牌载荷模型"""
    sub: int
    exp: int

class Login(BaseModel):
    """登录请求模型"""
    account_id: str = Field(..., description="学号")
    password: str = Field(..., description="密码")

class LoginResponse(BaseModel):
    """登录响应模型"""
    access_token: str
    token_type: str = "bearer"
    user_id: int
    role: str